<?php 

//$json = file_get_contents('./ScrapBook_multi.json', FILE_USE_INCLUDE_PATH);
//$data = json_decode($json, TRUE);
//echo $json;
//print_r($data);
session_start();
$username = "rm.herwidodo@babytivities.com";
$password = "234";
$id = "8FB666438BB4470D87473073FAE8B7D3";
$url = "http://localhost:8080/moms-diary/services/feeds/".$id;

$auth = $username.":".$password;

$context = stream_context_create(array(
    'http' => array(
        'header'  => "Authorization: Basic " . base64_encode($auth)
	)
));
$datas = file_get_contents($url, false, $context);
$data = json_decode($datas,TRUE);
//print_r($data);
?>

<?php foreach($data as $row):?>
<div class="row">
	<div class="span2 bbtvts_feed_thumb">
		<a href="#" class="thumbnail"> <img src="<?php echo $row["picPath"];?>"
			alt="">
		</a> <small><?php echo $row["title"];?></small>
		<div class="row">
			<a href="#" style="float: right;"> <span class="label label-info">Like</span>
				<span class="label label-success">Follow</span>
			</a>
		</div>
	</div>
	<div class="span6 bbtvts_feed_content">
		<div class="row">
			<div class="span6">
				<p>Comments</p>
			</div>
		</div>
		<?php foreach($row["comments"] as $comment):?>
			<div class="row comment_list">
				<div class="span5 comment_list_border">
					<span class="username_list_body"><?php echo $comment["firstName"].".".$comment["lastName"];?>:</span> <span
						class="comments_list_body"><?php echo $comment["comment"];?></span>
				</div>
				<div class="span1" style="text-align: center">
					<span class="badge badge-important">6</span>
					<p>
						<small>minute ago</small>
					</p>
				</div>
			</div>
		<?php endforeach; ?>
			<div class="span1" style="text-align: center">
		<div class="row">
			<div class="span10">
				<textarea rows="3" cols="50"
					style="margin: 0px 0px 14px; height: 80px; width: 450px;"></textarea>
			</div>
		</div>
	</div>
</div>
<!----FEED LIST EOF------>
<hr>
</div>
<?php endforeach; ?>